#!/usr/bin/env/python3.7
# -*- coding: utf-8 -*-

"""
@File    : gpios.py
@Time    : 12/16/2021
@Author  : Silence
@Version : 1.0
@Contact : silence2021silence@163.com
@License : (C)Copyright 2021-2021, Silence
@Desc    : None
"""

import socket

class GetLocalHostIPAddress():
    def get_localhost_ip_address():
        try:
            s=socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
            s.connect(('8.8.8.8',80))
            ip=s.getsockname()[0]
        finally:
            s.close()
        return ip


if __name__ == '__main__':
    print(get_localhost_ip_address())